package com.jiecao.news.jiecaonews.util;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;

public class MarketUtil {
    /**
* market://search?q=pname:<package>
*/
	
public static  void startSearchPNAMEIntent(Activity act){
	Uri uri = Uri.parse("market://search?q=pname:"+act.getPackageName());         
	Intent it = new Intent(Intent.ACTION_VIEW, uri);         
	act.startActivity(it); 
}

/**
* market://search?q=pnames:<package>
*/
public static  void startSearchPNAMESIntent(Activity act,String pkgnames){
	
	Uri uri = Uri.parse("market://search?q=pnames:"+pkgnames);         
	Intent it = new Intent(Intent.ACTION_VIEW, uri);         
	act.startActivity(it); 
}

/**
* market://search?q=pub:Your Publisher Name
*/
public static  void startSearchPUBIntent(Activity act,String pub){
	Uri uri = Uri.parse("market://search?q=pub:"+pub);         
	Intent it = new Intent(Intent.ACTION_VIEW, uri);         
	act.startActivity(it); 
}

/**
* market://details?id=<package_name>
*/
public static  void startSearchIDIntent(Activity act,String id){
	Uri uri = Uri.parse("market://search?id="+id);         
	Intent it = new Intent(Intent.ACTION_VIEW, uri);         
	act.startActivity(it); 
}
/**
 * 失败，只能倒开豌豆荚，但是不能定位
 * @param act
 */
public static void startMarket(Activity act){
	Uri uri = Uri.parse("market://search?id="+"com.tencent.news");    
	Intent it = new Intent(Intent.ACTION_VIEW,uri);
	it.setComponent(new ComponentName("com.wandoujia.phoenix2","com.wandoujia.phoenix2.NewWelcomeActivity"));
//	it.setAction();
	act.startActivity(it);
}
}
